﻿using B.S.Sterilizationcenter.Domain.yjb;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Appliaction.Commends.yjb;
using MediatR;
using SqlSugar;

namespace B.S.Sterilizationcenter.Read.API.Appliaction.CommandHandlers.yjb
{
    public class FantianProgramInfoCommandHandlers : IRequestHandler<FantianProgramInfoCommand, ApiResult<List<ProgramInfo>>>
    {
        private readonly ISqlSugarClient db;

        public FantianProgramInfoCommandHandlers(ISqlSugarClient db)
        {
            this.db = db;
        }
        public Task<ApiResult<List<ProgramInfo>>> Handle(FantianProgramInfoCommand request, CancellationToken cancellationToken)
        {
            ApiResult<List<ProgramInfo>> result = new ApiResult<List<ProgramInfo>>();
            List<ProgramInfo> list = db.Queryable<ProgramInfo>().Where(o => o.ProgramInfoId == request.ProgramInfoId).ToList();
            result.Code = ApiEnums.查询成功;
            result.Msg = "查询成功";
            result.Data = list;
            return Task.FromResult(result);
        }
    }
}
